﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TournamentDatabase.Database;

namespace TournamentDatabase.Objects
{
	public class Member
	{
		protected int m_mid;
		private string m_name;
		private string m_address;
		private string m_contact;

		public int MemberID
		{
			get { return m_mid; }
			set { m_mid = value; }
		}
		public string Name
		{
			get { return m_name; }
			set { m_name = value; }
		}
		public string Address
		{
			get { return m_address; }
			set { m_address = value; }
}
		public string Contact
		{
			get { return m_contact; }
			set { m_contact = value; }
		}

		public Member() : this(0, "", "", "") { }
		public Member(int mid, string name, string address, string contact)
		{
			m_mid = mid;
			m_name = name;
			m_address = address;
			m_contact = contact;
		}
		public Member(OracleDataReader odr)
		{
			MemberID = int.Parse(odr["mid"]);
			Name = odr["name"].ToString();
			Address = odr["address"].ToString();
			Contact = odr["contact"].ToString();
		}

        public static List<Member> ParseMember(OracleDataReader odr)
        {
            List<Member> list = new List<Member>();
            while (odr.Read())
            {
                list.Add(new Member());
            }
            return list;
        } 
	}
}
